﻿@model IEnumerable<string>

<h1>
@ViewBag.IntRef
</h1>
@using (Html.BeginForm("AllocatePurchaseOrder", "Leads", FormMethod.Post))
{
    <fieldset>
        <label style="font-family: 'Trebuchet MS'; color: #808000">Filter on ...</label>
        <label>Surname</label><input type="text" id="txtSurname" name="txtsurname" value="@(ViewBag.Surname)"/>
        <label>Postcode</label><input type="text" id="txtPostcode" name="txtpostcode" value="@(ViewBag.Postcode)"/>
        <input type="hidden" id="id" name="id" value="@(ViewBag.LeadID)" />
        <input type="submit" id="btnFilter" style="font-family: 'Trebuchet MS'; font-size: small; color: #808080" />
    </fieldset>
}
<div class="spacer"></div>
<div id="accordion">
@{
	int iCounter = 1; 
	foreach (var item in Model)
	{
    <h3>@item</h3>
    <div id="showleads@(iCounter.ToString())"></div>
		iCounter++;
	}
}
</div>
	
<script type="text/javascript">
 $(document).ready(function () {

    $('#notice').hide();

    $(function() {
        $( "#accordion" ).accordion({
          heightStyle: "content"
        });
    });


    @{
        iCounter=1;
        foreach(var item in Model)
        {
            <text>
                $("#showleads@(iCounter.ToString())").html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
                $('#showleads@(iCounter.ToString())').load('@(Url.Action("ShowLeadsByDate", "Leads"))?leadDate="@(item)"&id=@(ViewBag.LeadID)&indexer=@(iCounter.ToString())&Surname=@(ViewBag.Surname)&Postcode=@(ViewBag.Postcode)');
            </text>
            iCounter++;
        }
    }

 });
</script>